package info.qingshui.browser;

import java.util.*;




import android.content.*;
import android.view.*;
import android.widget.*;
import info.qingshui.browser.R;
import info.qingshui.browser.hk.index.*;

/**
 * http://code.google.com/p/myandroidwidgets/source/browse/trunk/Phonebook/src/com/abeanie/PhonebookAdapter.java
 *
 */
public class UrlsAdapter extends BaseAdapter{
    private Context context;

    private List<URLInfo> listURLInfo;

    public UrlsAdapter(Context context, List<URLInfo> listURLInfo) {
        this.context = context;
        this.listURLInfo = listURLInfo;
    }

    public int getCount() {
        return listURLInfo.size();
    }

    public Object getItem(int position) {
        return listURLInfo.get(position);
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup viewGroup) {
    	URLInfo entry = listURLInfo.get(position);
        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.item, null);
        }
        TextView tvContact = (TextView) convertView.findViewById(R.id.item_title);
        tvContact.setText(entry.getTitle());



        return convertView;
    }

//    @Override
//    public void onClick(View view) {
//    	URLInfo entry = (URLInfo) view.getTag();
//        listPhonebook.remove(entry);
//        // listPhonebook.remove(view.getId());
//        notifyDataSetChanged();
//
//    }

//    private void showDialog(URLInfo entry) {
//        // Create and show your dialog
//        // Depending on the Dialogs button clicks delete it or do nothing
//    }


}

